#include <stdio.h>
#include "library.h"
#include "../shared/dllexport.h"

static char openfirec_version[20];

DLLEXPORT(int) openfirec_compatibility(int major, int minor, int api, int build) {
	if (major > OPENFIREC_VER_MAJOR) return OPENFIREC_NOT_COMPATIBLE;
	if (major == OPENFIREC_VER_MAJOR && minor > OPENFIREC_VER_MINOR) return OPENFIREC_NOT_COMPATIBLE;
	if (api != OPENFIREC_VER_API) return OPENFIREC_NOT_COMPATIBLE;
	if (major < OPENFIREC_VER_MAJOR || minor != OPENFIREC_VER_MINOR) return OPENFIREC_MAYBE_COMPATIBLE;
	if (build > OPENFIREC_VER_BUILD) return OPENFIREC_MAYBE_COMPATIBLE;
	return OPENFIREC_COMPATIBLE;
}

DLLEXPORT(char *) get_openfirec_version(void) {
	sprintf(openfirec_version, "%d.%d.%d.%d", OPENFIREC_VER_MAJOR, OPENFIREC_VER_MINOR, OPENFIREC_VER_API, OPENFIREC_VER_BUILD);
	return openfirec_version;
}
